package com.bm.domain.doc;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Document(indexName = "book_index",createIndex = true)
public class BookDoc {
    @Id
    @Field(type= FieldType.Text)
    private String id;
    @Field(type= FieldType.Text)
    private String title;
    @Field(type= FieldType.Text)
    private String author;
    @Field(type= FieldType.Double)
    private Integer publisher;
    @Field(type= FieldType.Text)
    private String isbn;
    @Field(type= FieldType.Double)
    private Double price;
    @Field(type= FieldType.Integer)
    private int version;
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Field(type= FieldType.Date)
    private Date pubdate;
    @Field(type= FieldType.Integer)
    private int store;
    @Field(type= FieldType.Text)
    private String imgurl;
    @Field(type= FieldType.Integer)
    private Integer weight;
    @Field(type= FieldType.Integer)
    private Integer type;
    @Field(type= FieldType.Text)
    private String introduction;
    @Field(type= FieldType.Integer)
    private int sold;
    @Field(type= FieldType.Integer)
    private int pages;
    @Field(type= FieldType.Date)
    private Date createTime;
    @Field(type= FieldType.Date)
    private Date updateTime;
    @Field(type= FieldType.Text)
    private String createBy;
}
